<?php

/**
 * @author игорь
 * @copyright 2009
 */
$action_template = "index";
if(!empty($cats))
{
	$cat_lim = 4;
	$i = 0;
	foreach($cats as $k=>$v)
	{
		$game_array = $obj->db->fetch_array("SELECT SQL_CALC_FOUND_ROWS $obj->id FROM $obj->table WHERE image = '1' AND file = '1' AND status = '2' AND category_id = '".$v['id']."' ORDER BY rating DESC,votes DESC, hits DESC, id DESC LIMIT 0,1");
		$game_qnty = $obj->db->fetch_one(QUANTITY);
		if(!empty($game_array))
		{
			$game = $obj->getFullInfoById($game_array[0][$obj->id]);
			$game['navigation'] = array(
				'prev' => false,
				'next' => (intval($game_qnty[0]) > 1 ? 1 : 0),
				'from' => 0
			);
			$items[$i] = $v;
			$items[$i]['game'] = $game;
			$i++;
		}
	}
	$smarty->assign("items",$items);
}
$header = $this->info['title'];
$smarty->assign("header",$header);
?>